/**
 * 静态方法
 * Name = helper
 * DateTime = Mon Jan 17 2022 13:14:58 GMT+0800 (中国标准时间)
 * Author = Created by zhj9922
 * FileBasename = helper.ts
 * gitee： https://gitee.com/coyeking
 */
import { sys } from "cc";
 
export class helper {
    /**
     * 截断用户过长昵称
     * @param nickname 用户昵称
     * @returns 
     */
    public static convertNickname (nickname: string,length:number=8):string {
        let newNickname = nickname;
        if (newNickname.length > 7) {
            newNickname = nickname.substring(0, length) + '****';
        }
        return newNickname;
    };

    /**
     * 查看网络图片url是否带后缀
     * @param {string} path
     * @param {object} param
     * @param {function} onComplete
     * @param {function} onIOError
     */
     public static testUrlAttachSuffix(url:string):string{
        var _url = url;
        var str = _url.slice(url.length-4);
        if (str == '.png' || str == '.jpg'){
            return _url;
        }
        return _url  + "?.jpg";
    }


    


}

